function selectionSort(arr){
    const len = arr.length;
    for (let i = 0; i < len; i++){
        let min = arr[i];
        let index = i;
        for (let j = i; j < len; j++){
            if (min > arr[j + 1]){
                min = arr[j + 1]
                index = j + 1;
            }
        }
        if (index !== i){
            let temp = arr[i];
            arr[i] = arr[index];
            arr[index] = temp;
        }
    }
    console.log(arr)
}

selectionSort([12, 3, 42, 32, 213, 2, 3, 41, 232, 34, 54, 657, 67]);
